import {
  validatePhone,
  validateEmail,
  validateIdCard,
  validateMoney,
  validateBankId
} from "@/utils/validates.js"

const addSchedulingForm = {
  formRules: {
    name: {
      rules: [
        {
          required: true,
          errorMessage: "请输入店铺名称"
        }
      ]
    },
    day_time: {
      rules: [
        {
          required: true,
          errorMessage: "请选择上课日期"
        }
      ]
    },
    time: {
      rules: [
        {
          required: true,
          errorMessage: "请选择上课时间"
        }
      ]
    },
    teacher_id: {
      rules: [
        {
          required: true,
          errorMessage: "请选择教练"
        }
      ]
    },
    user_data: {
      rules: [
        {
          required: true,
          errorMessage: "请选择学生"
        }
      ]
    },
    category_type: {
      rules: [
        {
          required: true,
          errorMessage: "请选择课程类型"
        }
      ]
    }
  },
  formList: [
    {
      formType: "select",
      name: "school_id",
      label: "店铺名称",
      placeholder: "请输入店铺名称",
      value: "",
      options: [],
      required: true
    },
    {
      formType: "date",
      name: "day_time",
      label: "上课日期",
      placeholder: "请选择上课日期",
      value: "",
      required: true
    },
    {
      formType: "timeRange",
      name: "timeRange",
      label: "上课时间",
      placeholder: "请选择上课时间",
      value: "",
      required: true
    },

    {
      formType: "select",
      name: "teacher_id",
      label: "教练姓名",
      placeholder: "请选择教练",
      options: [],
      value: "",
      required: true
    },

    {
      formType: "select",
      name: "user_data",
      label: "学生姓名",
      placeholder: "请选择学生姓名",
      options: [],
      value: "",
      required: true,
      multiple: true
    },
    {
      formType: "select",
      name: "plan_type",
      label: "课程类型",
      placeholder: "请选择课程类型",
      options: [
        {
          text: "正式课",
          value: 1
        },
        {
          text: "体验课",
          value: 2
        },
        {
          text: "复习课",
          value: 3
        }
      ],
      value: "",
      required: true
    },
    {
      formType: "select",
      name: "category_type",
      label: "课程大类",
      placeholder: "请选择课程大类",
      options: [],
      value: "",
      required: true
    },
    {
      formType: "select",
      name: "first_category_id",
      label: "一级分类",
      placeholder: "请选择一级分类",
      options: [],
      value: "",
      required: true
    },
    {
      formType: "select",
      name: "second_category_id",
      label: "二级分类",
      placeholder: "请选择二级分类",
      options: [],
      value: "",
      required: true
    },
    {
      formType: "select",
      name: "version_id",
      label: "课程版本",
      placeholder: "请选择课程版本",
      options: [],
      value: "",
      required: true,
      placement: "top"
    }
  ],
  formField: {
    school_id: "",
    day_time: "",
    teacher_id: "",
    user_data: [],
    plan_type: "",
    category_type: "",
    first_category_id: "",
    second_category_id: "",
    version_id: "",
    timeRange: []
  }
}

const addCoachForm = {
  formRules: {
    teacher_nickname: {
      rules: [
        {
          required: true,
          errorMessage: "请输入教练姓名"
        }
      ],
      validateTrigger: "blur"
    },
    teacher_phone: {
      rules: [
        {
          required: true,
          errorMessage: "请输入手机号码"
        },
        {
          validateFunction: validatePhone
        }
      ]
    },
    school_id: {
      rules: [
        {
          required: true,
          errorMessage: "请选择"
        }
      ]
    }
  },
  formList: [
    {
      formType: "input",
      name: "teacher_nickname",
      label: "姓名/账号",
      placeholder: "请输入教练姓名",
      value: "",
      required: true
    },
    {
      formType: "input",
      name: "teacher_phone",
      label: "手机号码",
      type: "tel",
      placeholder: "请输入手机号码",
      value: "",
      required: true
    },
    {
      formType: "select",
      name: "school_id",
      label: "学校名称",
      placeholder: "请选择学校",
      value: "",
      options: uni.getStorageSync("dictMap")
        ? uni.getStorageSync("dictMap").allSchool.map((item) => {
            return {
              text: item.school_name,
              value: item.id
            }
          })
        : [],
      required: true
    }
  ],
  formField: {
    teacher_nickname: "",
    teacher_phone: "",
    school_id: ""
  }
}
export { addSchedulingForm, addCoachForm }
